using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._GeocodingTools._Portal
{
    /// <summary>
    /// <para>Geocode Locations From Table</para>
    /// <para>Geocodes hosted tables using locators hosted on an ArcGIS Enterprise portal, which creates a hosted feature layer containing the geocoded results.</para>
    /// <para>使用 ArcGIS Enterprise 门户上托管的定位器对托管表进行地理编码，该门户将创建包含地理编码结果的托管要素图层。</para>
    /// </summary>    
    [DisplayName("Geocode Locations From Table")]
    public class GeocodeLocationsFromTable : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GeocodeLocationsFromTable()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table on the portal that contains addresses or places to geocode.</para>
        /// <para>门户上包含要进行地理编码的地址或地点的表。</para>
        /// </param>
        /// <param name="_in_address_locator">
        /// <para>Address Locator</para>
        /// <para><xdoc>
        ///   <para>The portal locator that will be used to geocode the input table from the portal.</para>
        ///   <para>You can select a locator from the populated list of locators on the active portal or browse the active portal for other available locators. Locators that have been set as utility services in the active portal will be available by default. If the portal locator you want to use is not in the populated list, ask your portal administrator to add the locator as a portal utility service, and configure the locator for batch geocoding.</para>
        ///   <para>The ArcGIS World Geocoding Service is disabled for this tool. Use the Geocode Addresses tool if you want to use the ArcGIS World Geocoding Service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于对门户中的输入表进行地理编码的门户定位器。</para>
        ///   <para>您可以从活动门户上填充的定位器列表中选择一个定位器，也可以在活动门户中浏览其他可用定位器。默认情况下，在活动门户中设置为实用程序服务的定位器将可用。如果要使用的门户定位器不在填充列表中，请让门户管理员将定位器添加为门户实用程序服务，并配置定位器以进行批量地理编码。</para>
        ///   <para>此工具禁用了 ArcGIS World Geocoding Service。如果要使用 ArcGIS World Geocoding Service，请使用地理编码地址工具。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_address_fields">
        /// <para>Address Field Mapping</para>
        /// <para><xdoc>
        ///   <para>The mapping of address fields used by the locator to fields in the input table of addresses. Select Single Field if the complete address is stored in one field in the input table, for example, 303 Peachtree St NE, Atlanta, GA 30308. Select Multiple Fields if the input addresses are split into multiple fields such as Address, City, State, and ZIP for a general United States address.</para>
        ///   <para>Some locators support multiple input address fields such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields and the address fields will be concatenated at the time of geocoding. For example, 100, Main St, and Apt 140 across three fields or 100 Main St and Apt 140 across two fields would both become 100 Main St Apt 140 when geocoding.</para>
        ///   <para>If you choose not to map an optional input address field used by the locator to a field in the input table of addresses, specify that there is no mapping by using <None> in place of a field name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定位器使用的地址字段到地址输入表中的字段的映射。如果完整地址存储在输入表中的一个字段中，请选择“单个字段”，例如，303 Peachtree St NE， Atlanta， GA 30308。如果输入地址拆分为多个字段，例如美国通用地址的地址、城市、州和 ZIP，请选择多个字段。</para>
        ///   <para>某些定位器支持多个输入地址字段，例如地址、地址 2 和地址 3。在这种情况下，地址组件可以分成多个字段，并且地址字段将在地理编码时连接起来。例如，地理编码时，三个字段中的 100， Main St 和 Apt 140 或两个字段中的 100 Main St 和 Apt 140 都将变为 100 Main St Apt 140。</para>
        /// <para>如果选择不将定位器使用的可选输入地址字段映射到输入地址表中的字段，请指定不使用 <None> in 代替字段名称进行映射。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_output_name">
        /// <para>Output Feature Layer Name</para>
        /// <para>The name of the output geocoded feature layer that will be created on the portal.</para>
        /// <para>将在门户上创建的输出地理编码要素图层的名称。</para>
        /// </param>
        public GeocodeLocationsFromTable(object _in_table, object _in_address_locator, object _address_fields, object _output_name)
        {
            this._in_table = _in_table;
            this._in_address_locator = _in_address_locator;
            this._address_fields = _address_fields;
            this._output_name = _output_name;
        }
        public override string ToolboxName => "Geocoding Tools";

        public override string ToolName => "Geocode Locations From Table";

        public override string CallName => "geocoding.GeocodeLocationsFromTable";

        public override List<string> AcceptEnvironments => ["outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_table, _in_address_locator, _address_fields, _output_name, _country, _location_type.GetGPValue(), _category, _output_layer, _output_fields.GetGPValue()];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table on the portal that contains addresses or places to geocode.</para>
        /// <para>门户上包含要进行地理编码的地址或地点的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Address Locator</para>
        /// <para><xdoc>
        ///   <para>The portal locator that will be used to geocode the input table from the portal.</para>
        ///   <para>You can select a locator from the populated list of locators on the active portal or browse the active portal for other available locators. Locators that have been set as utility services in the active portal will be available by default. If the portal locator you want to use is not in the populated list, ask your portal administrator to add the locator as a portal utility service, and configure the locator for batch geocoding.</para>
        ///   <para>The ArcGIS World Geocoding Service is disabled for this tool. Use the Geocode Addresses tool if you want to use the ArcGIS World Geocoding Service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于对门户中的输入表进行地理编码的门户定位器。</para>
        ///   <para>您可以从活动门户上填充的定位器列表中选择一个定位器，也可以在活动门户中浏览其他可用定位器。默认情况下，在活动门户中设置为实用程序服务的定位器将可用。如果要使用的门户定位器不在填充列表中，请让门户管理员将定位器添加为门户实用程序服务，并配置定位器以进行批量地理编码。</para>
        ///   <para>此工具禁用了 ArcGIS World Geocoding Service。如果要使用 ArcGIS World Geocoding Service，请使用地理编码地址工具。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Address Locator")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_address_locator { get; set; }


        /// <summary>
        /// <para>Address Field Mapping</para>
        /// <para><xdoc>
        ///   <para>The mapping of address fields used by the locator to fields in the input table of addresses. Select Single Field if the complete address is stored in one field in the input table, for example, 303 Peachtree St NE, Atlanta, GA 30308. Select Multiple Fields if the input addresses are split into multiple fields such as Address, City, State, and ZIP for a general United States address.</para>
        ///   <para>Some locators support multiple input address fields such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields and the address fields will be concatenated at the time of geocoding. For example, 100, Main St, and Apt 140 across three fields or 100 Main St and Apt 140 across two fields would both become 100 Main St Apt 140 when geocoding.</para>
        ///   <para>If you choose not to map an optional input address field used by the locator to a field in the input table of addresses, specify that there is no mapping by using <None> in place of a field name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定位器使用的地址字段到地址输入表中的字段的映射。如果完整地址存储在输入表中的一个字段中，请选择“单个字段”，例如，303 Peachtree St NE， Atlanta， GA 30308。如果输入地址拆分为多个字段，例如美国通用地址的地址、城市、州和 ZIP，请选择多个字段。</para>
        ///   <para>某些定位器支持多个输入地址字段，例如地址、地址 2 和地址 3。在这种情况下，地址组件可以分成多个字段，并且地址字段将在地理编码时连接起来。例如，地理编码时，三个字段中的 100， Main St 和 Apt 140 或两个字段中的 100 Main St 和 Apt 140 都将变为 100 Main St Apt 140。</para>
        /// <para>如果选择不将定位器使用的可选输入地址字段映射到输入地址表中的字段，请指定不使用 <None> in 代替字段名称进行映射。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Address Field Mapping")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _address_fields { get; set; }


        /// <summary>
        /// <para>Output Feature Layer Name</para>
        /// <para>The name of the output geocoded feature layer that will be created on the portal.</para>
        /// <para>将在门户上创建的输出地理编码要素图层的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Layer Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_name { get; set; }


        /// <summary>
        /// <para>Country</para>
        /// <para><xdoc>
        ///   <para>The country or countries to search for the geocoded addresses. This parameter is available for locators that support a country parameter and will limit geocoding to the selected countries. Making a country selection will improve the accuracy of geocoding in most cases. If a field representing countries in the Input Table parameter is mapped to the Country Input Address Field, the country value from the Input Table parameter will override the Country parameter.</para>
        ///   <para>If no country is specified, geocoding is performed using all supported countries of the locator.</para>
        ///   <para>The Country parameter is not supported for all locators.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要搜索地理编码地址的一个或多个国家/地区。此参数可用于支持国家/地区参数的定位器，并将地理编码限制为所选国家/地区。在大多数情况下，选择国家/地区将提高地理编码的准确性。如果将“输入表”参数中表示国家/地区的字段映射到“国家/地区输入地址字段”，则“输入表”参数中的国家/地区值将覆盖“国家/地区”参数。</para>
        ///   <para>如果未指定国家/地区，则使用定位器支持的所有国家/地区执行地理编码。</para>
        ///   <para>并非所有定位器都支持 Country 参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Country")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _country { get; set; } = null;


        /// <summary>
        /// <para>Preferred Location Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the preferred output geometry for PointAddress matches. The options for this parameter are Routing location, which is the side of street location that can be used for routing and Address location, which is the location that represents the rooftop or parcel centroid for the address. If the preferred location does not exist in the data, the default location will be returned. For geocode results with Addr_type=PointAddress, the x,y attribute values describe the coordinates of the address along the street, while the DisplayX and DisplayY values describe the rooftop, or building centroid, coordinates.</para>
        ///   <para>This parameter is not supported for all locators.</para>
        ///   <bulletList>
        ///     <bullet_item>Address location—Geometry for geocode results that represent an address location such as a rooftop location, parcel centroid, or front door is returned.</bullet_item><para/>
        ///     <bullet_item>Routing location—Geometry for geocode results that represent a location close to the side of the street that can be used for vehicle routing is returned. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定 PointAddress 匹配的首选输出几何图形。此参数的选项包括路径定位（路径位置）和地址位置（表示地址的屋顶或宗地质心的位置）。如果数据中不存在首选位置，则返回默认位置。对于具有 Addr_type=PointAddress 的地理编码结果，x，y 属性值描述沿街道的地址坐标，而 DisplayX 和 DisplayY 值描述屋顶或建筑物质心坐标。</para>
        ///   <para>并非所有定位器都支持此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>地址位置 - 返回表示地址位置（例如屋顶位置、宗地质心或前门）的地理编码结果的几何。</bullet_item><para/>
        ///     <bullet_item>路径定位 - 返回表示可用于车辆路径规划的靠近街道一侧的位置的地理编码结果的几何图形。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Preferred Location Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _location_type_value _location_type { get; set; } = _location_type_value._ROUTING_LOCATION;

        public enum _location_type_value
        {
            /// <summary>
            /// <para>Routing location</para>
            /// <para>Routing location—Geometry for geocode results that represent a location close to the side of the street that can be used for vehicle routing is returned. This is the default.</para>
            /// <para>路径定位 - 返回表示可用于车辆路径规划的靠近街道一侧的位置的地理编码结果的几何图形。这是默认设置。</para>
            /// </summary>
            [Description("Routing location")]
            [GPEnumValue("ROUTING_LOCATION")]
            _ROUTING_LOCATION,

            /// <summary>
            /// <para>Address location</para>
            /// <para>Address location—Geometry for geocode results that represent an address location such as a rooftop location, parcel centroid, or front door is returned.</para>
            /// <para>地址位置 - 返回表示地址位置（例如屋顶位置、宗地质心或前门）的地理编码结果的几何。</para>
            /// </summary>
            [Description("Address location")]
            [GPEnumValue("ADDRESS_LOCATION")]
            _ADDRESS_LOCATION,

        }

        /// <summary>
        /// <para>Category</para>
        /// <para><xdoc>
        ///   <para>Limits the types of places the locator searches, eliminating false positive matches and potentially speeding up the search process. When no category is used, geocoding is performed using all supported categories. Not all category values are supported for all locations and countries. In general, the Category parameter can be used for the following:
        ///   <bulletList>
        ///     <bullet_item>Limit matches to specific place types or address levels  </bullet_item><para/>
        ///     <bullet_item>Avoid fallback matches to unwanted address levels  </bullet_item><para/>
        ///     <bullet_item>Disambiguate coordinate searches  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>This parameter is not supported for all locators.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>限制定位器搜索的地点类型，消除误报匹配，并可能加快搜索过程。如果未使用类别，则使用所有支持的类别执行地理编码。并非所有地区和国家/地区都支持所有类别值。通常，Category 参数可用于以下用途：
        ///   <bulletList>
        ///     <bullet_item>将匹配限制为特定地点类型或地址级别</bullet_item><para/>
        ///     <bullet_item>避免回退匹配到不需要的地址级别</bullet_item><para/>
        ///     <bullet_item>消除坐标搜索的歧义</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>并非所有定位器都支持此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Category")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _category { get; set; } = null;


        /// <summary>
        /// <para>Output Layer</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Layer")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output_layer { get; set; }


        /// <summary>
        /// <para>Output Fields</para>
        /// <para><xdoc>
        ///   <para>Specifies which locator output fields are returned in the geocode results.</para>
        ///   <para>This parameter can be used with input locators created with the Create Locator tool or Create Feature Locator tool published to Enterprise 10.9 or later. Composite locators that contain at least one locator created with the Create Address Locator tool do not support this parameter.</para>
        ///   <bulletList>
        ///     <bullet_item>All— Includes all available locator output fields in the geocode results. This is the default.</bullet_item><para/>
        ///     <bullet_item>Location Only—Stores the Shape field in the geocode results. The original field names from the Input Table parameter are maintained with their original field names. Rematching geocode results is not available with this option.</bullet_item><para/>
        ///     <bullet_item>Minimal—Adds the following fields that describe the location and how well it matches to information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter are maintained with their original field names.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在地理编码结果中返回的定位器输出字段。</para>
        ///   <para>此参数可用于使用发布到 Enterprise 10.9 或更高版本的创建定位器工具创建的输入定位器。包含至少一个使用创建地址定位器工具创建的定位器的复合定位器不支持此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>全部 - 在地理编码结果中包括所有可用的定位器输出字段。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>仅位置 - 将形状字段存储在地理编码结果中。输入表参数中的原始字段名称将与其原始字段名称一起保留。此选项不提供重新匹配地理编码结果。</bullet_item><para/>
        ///     <bullet_item>最小值 - 添加以下字段，用于描述位置及其与地理编码结果中定位器中信息的匹配程度：形状、状态、分数、Match_type、Match_addr和Addr_type。输入表参数中的原始字段名称将与其原始字段名称一起保留。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Fields")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _output_fields_value _output_fields { get; set; } = _output_fields_value._ALL;

        public enum _output_fields_value
        {
            /// <summary>
            /// <para>All</para>
            /// <para>All— Includes all available locator output fields in the geocode results. This is the default.</para>
            /// <para>全部 - 在地理编码结果中包括所有可用的定位器输出字段。这是默认设置。</para>
            /// </summary>
            [Description("All")]
            [GPEnumValue("ALL")]
            _ALL,

            /// <summary>
            /// <para>Minimal</para>
            /// <para>Minimal—Adds the following fields that describe the location and how well it matches to information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter are maintained with their original field names.</para>
            /// <para>最小值 - 添加以下字段，用于描述位置及其与地理编码结果中定位器中信息的匹配程度：形状、状态、分数、Match_type、Match_addr和Addr_type。输入表参数中的原始字段名称将与其原始字段名称一起保留。</para>
            /// </summary>
            [Description("Minimal")]
            [GPEnumValue("MINIMAL")]
            _MINIMAL,

            /// <summary>
            /// <para>Location Only</para>
            /// <para>Location Only—Stores the Shape field in the geocode results. The original field names from the Input Table parameter are maintained with their original field names. Rematching geocode results is not available with this option.</para>
            /// <para>仅位置 - 将形状字段存储在地理编码结果中。输入表参数中的原始字段名称将与其原始字段名称一起保留。此选项不提供重新匹配地理编码结果。</para>
            /// </summary>
            [Description("Location Only")]
            [GPEnumValue("LOCATION_ONLY")]
            _LOCATION_ONLY,

        }

        public GeocodeLocationsFromTable SetEnv(object outputCoordinateSystem = null)
        {
            base.SetEnv(outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}